//开启服务器
const express = require('express');
const app = express();
app.listen(3000, () => { console.log('服务器已开启') });

const path = require('path');

app.get('/', (req, res) => {
    res.sendFile(path.join(__dirname, '2.前端.html'))
})
//引入mysql
const mysql = require('./mysql封装');

app.get('/shop',async(req,res)=>{
    let sql=`select * from trade`;
    let [err,result]=await mysql(sql);
    console.log(result,result.lengtn);
    res.send(result)
})
